package com.example.yls.demoa;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
private Button btn_start;
private Button btn_intent_start;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        btn_start=findViewById(R.id.btn_start);
        btn_intent_start=findViewById(R.id.btn_start_intent);


        btn_start.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(MainActivity.this,MyFrontService.class);
                startService(intent);
            }
        });



        btn_intent_start.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(MainActivity.this,MyIntentService.class);
                /*intent.putExtra("URL","Http://www.baodu.com/hello.mp3");*/
                startService(intent);
            }
        });
    }

}
